<?php include "top.php"; ?>
  <?php
		 $nid=make_safe($_GET["nid"]); 
		 if($nid==""){$nid=1;}
		 
		if($nid==1){$nidname="公司樣本";}
		 if($nid==2){$nidname="禮服";}
		 if($nid==3){$nidname="客戶";}
		 
		 
		?>

      <div id="top-3">
        <div id="m-text-1">
        <table border="0" cellpadding="0" cellspacing="0" class="tab-5">
   <tr>
     <td valign="top"><div class="tab-5-tit">主功能列表</div>
     <div class="m-text-2_btn"><a href="category.php?nid=<?php echo $nid;?>">作品分類管理</a></div>
     
       <div class="tab-5-tit">相簿管理</div>
      
	 
	 <?php
  $n=1;

  $sql="select * from product_type_big where nid='$nid' order by orderid  ";			
	$result=mysql_query($sql);
	while ($row=mysql_fetch_object($result)){
	?>
     <div class="m-text-2_btn"><a href="working.php?nid=<?php echo $nid;?>&BigClassName=<?php echo urlencode($row->BigClassName);?>"><?php echo $row->BigClassName;?></a></div>
     <?php }?>
	 
	 
	 
	 
       </td>
   </tr>
   </table>
        </div>
		
		
	
		
		
		
        <div id="m-text-2_banner">
          <ul>
            
            <li>/ </li>
            <li><a href="category_add.php?nid=<?php echo $nid;?>">新增</a></li>
            <li><?php echo $nidname;?>作品分類管理</li>
          </ul>
        </div><div id="m-text-2">
		
		
		<script language="javascript">
	function check(form1){
		if(form1.BigClassName.value==""){
			alert("请输入 類別!");form1.BigClassName.focus();return false;		
		}
		
	}
</script>	
		
		
		<?php 
		$nid=make_safe($_GET["nid"]); 
		$action=make_safe($_GET["action"]); 
		$BigClassName=make_safe($_POST["BigClassName"]); 
		if($action=="add"){
		

if($BigClassName!="" ){

$sql=mysql_query("select * from product_type_big where nid='$nid' and BigClassName = '$BigClassName'");
$result=mysql_fetch_array($sql);
if ($result!=false){
	echo "<script> alert('[".$BigClassName."] 已有的[類別]！');history.back();</script>";
}
else
{	

$sql="Insert Into product_type_big (nid,BigClassName,orderid) Values('$nid','$BigClassName','$orderid')";
$result=mysql_query($sql);

echo "<script> alert('類別 增加成功！');window.location.href='category.php?nid=$nid';</script>";
}


}
}

		
		

		
		
		
		
		?>
		
		
		
		<form name="form1" action="?action=add&nid=<?php echo $nid;?>" method="post">
<table border="0" cellpadding="0" cellspacing="0" class="m-text-2-con">
          <tr>
            <td class="m-text-2-con1">&nbsp;</td>
            <td class="m-text-2-con2">類別</td>
            <td class="m-text-2-con3">&nbsp;</td>
        </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="m-text-2-con">
          <tr>
            <td class="m-text-2-con1"><label for="checkbox"></label></td>
            <td class="m-text-2-con2"><label for="textfield2"></label>
              <input name="BigClassName" type="text"  size="30" />
			  
			  
			  <?php 
			  $nid=make_safe($_GET["nid"]); 
			   $sql="select * from product_type_big where nid='$nid' order by orderid desc limit 0,1";			
	$result=mysql_query($sql);
	while ($row=mysql_fetch_object($result)){	
		  
		  $orderid=$row->orderid+1;
		  }
		  if($orderid==0){$orderid=1;}
			  ?>
              <input type="hidden" name="orderid"  value="<?php echo $orderid?>"/></td>
            <td class="m-text-2-con3"><label for="textfield"></label></td>
            </tr>
</table>



<table border="0" cellpadding="0" cellspacing="0" class="m-text-2-con">
  <tr>
    <td class="m-text-2-con1"><label for="checkbox6"></label></td>
    <td class="m-text-2-con2"><input type="submit" name="button" id="button" value="新增"  onClick="return check(form1);"  /></td>
    <td class="m-text-2-con3"><label for="textfield5"></label></td>
  </tr>
</table>
</form>





        </div>
      </div>
    </div>
  </div>
</div>
<div id="botton"><div id="copyright"><table border="0" cellpadding="0" cellspacing="0" class="copy">
  <tr>
    <td>© COPYRIGHTS 2010 INC. APARTMENT STUDIO All rights reserved.</td>
  </tr>
</table>
</div></div>
</body>
</html>